/*
 * © Copyright 2011 Romain Marteau, Matthieu Totet
 * 
 *    This file is part of VineaToum.
 *
 *    VineaToum is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    VineaToum is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with VineaToum.  If not, see <http://www.gnu.org/licenses/>.
 *    
 */

package org.vineatoum.business.configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;

import org.vineatoum.view.utils.jtablecustom.TableListener;

@XmlRootElement(name="soilType")
@XmlAccessorType(XmlAccessType.FIELD)
public class SoilType extends TableListener {
	public static List<SoilType> soilTypes = new ArrayList<SoilType>();
	
	@XmlID
	@XmlAttribute
	private String name;
	
	public SoilType() {
		soilTypes.add(this);
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	@Override
	public TableListener getNewInstance() {
		return new SoilType();
	}

	@Override
	public Vector<Object> getVectorData() {
		Vector<Object> vector = new Vector<Object>();
		vector.add(name);
		return vector; 
	}

	@Override
	public void updateField(String field, Object value) {
		name = (String) value;
	}

	@Override
	public Vector<String> getVectorColumns() {
		Vector<String> columnSoilType = new Vector<String>();
		columnSoilType.add("Nom");
		
		return columnSoilType;
	}
	
	@Override
	public String toString() {
		return name;
	}
}
